package com.liugan.magic.screen;

import org.loon.framework.android.game.core.LSystem;
import org.loon.framework.android.game.core.graphics.component.LButton;
import org.loon.framework.android.game.core.graphics.opengl.LTexture;

import com.liugan.magic.Constants;
import com.liugan.magic.screen.layer.GameLayer;
import com.liugan.magic.utils.ImagesUtils4layer;
import com.liugan.magic.utils.ImagesUtils4start;

public class Testcode {
	
	
	
	//code1 使用的按钮
	LButton sound;
	boolean issound;
	LButton info;
	LButton setting;
	LButton b1,b2,b3,b4,b5;
	GameLayer glayer;
	int a_x,a_y,s_x,s_y,sound_x,sound_y;
	
	//阶段代码 0为不需要检测 1 是startlayer 2memulayer 3 gamelayer
	private int layercode=1;
	private int layertime=0;
	public void setLayercode(int code){
		this.layercode=code;
	}
	public void setLayertime(int time){
		this.layertime=time;
	}
	
	public void testcode(){
		a_x=Constants.ScreenWIDTH/2-ImagesUtils4start.getinstance().armorgames.getWidth()/2;
		a_y=Constants.ScreenHEIGHT/2-ImagesUtils4start.getinstance().armorgames.getHeight()/2;
		
		s_x=Constants.ScreenWIDTH/2-ImagesUtils4start.getinstance().start.getWidth()/2;
		s_y=Constants.ScreenHEIGHT/2-ImagesUtils4start.getinstance().start.getHeight()/2;
		
		
		
		switch (layercode) {
		case 1:
			if (layertime<1000){
				layertime++;
			}
			
			break;
		case 3:
			
			break;
		}
		
		
		switch (layercode) {
		case 1:{
			//g.drawString("layertime", 200,200);
				if (layertime<200){
					//g.drawImage(ImagesUtils4start.getinstance().armorgames,a_x,a_y );
				}else {
					//g.drawImage(ImagesUtils4start.getinstance().start,s_x,s_y );
					//添加按钮
					if (sound==null){
						
						sound=new LButton(ImagesUtils4layer.getinstance().sound_b[0],null,Constants.ScreenWIDTH-50,Constants.ScreenHEIGHT-50){
							@Override
							public void doClick() {
								if (issound){
									issound=false;
									LTexture[] buttons = new LTexture[1];
									buttons[0]=ImagesUtils4layer.getinstance().sound_b[1];
									this.setImages(buttons);
									LSystem.gc();
								}else{
									issound=true;
									LTexture[] buttons = new LTexture[1];
									buttons[0]=ImagesUtils4layer.getinstance().sound_b[0];
									this.setImages(buttons);
									LSystem.gc();
								}
							}
						};
						//默认打开音乐
						issound=true;
						//this.add(sound);
					}
				}
				
			}
			break;
		case 2:{
				
			
			
			
			
			}
			break;
		case 3: 

			break;
	}
	}
	


}
